package com.example.customview.view

import android.content.Context
import android.graphics.Canvas
import android.graphics.Color
import android.graphics.Paint
import android.graphics.PointF
import android.util.AttributeSet
import android.view.View

/**
 * Copyright (C), 2018.11-2021.05, 恒丰汇金有限公司<BR/>
 * FileName: CircleView<BR/>
 * Author: JiangYong<BR/>
 * Date: 2021/5/15 15:48<BR/>
 * Description: TODO java类作用描述<BR/>
 * History:<BR/>
 * <time> <version> <desc><BR/>
 *修改时间 版本号 描述
 */
class PointFView(context: Context, attrs: AttributeSet?) : View(context, attrs) {

    private val paint = Paint().apply {
        color = Color.BLACK
        isAntiAlias = true
        strokeWidth = 10.dp
        strokeCap = Paint.Cap.ROUND
    }

    var pointF = PointF()
        set(value) {
            field = value
            invalidate()
        }

    override fun onDraw(canvas: Canvas) {
        canvas.drawPoint(pointF.x, pointF.y, paint);
    }
}